import './utils/utils'
import './utils/http'

// app.js
App({

  onLaunch(){
    this.getToken()
  },
   // ------------自定义的各类方法
  // 1. 获取token
    
  getToken(){
    wx.getStorage({
      key:'token',
      success:(res)=>{
         // 把token存储到全局
        this.token=res.data
      },
       // 2. 存token

    })
  },
  setToken(token,refresh_token) {
    token = `Bearer ${token}`
    refresh_token = `Bearer ${refresh_token}`
    wx.setStorageSync('token', token)
    wx.setStorageSync('refresh_token', refresh_token)
    this.token = token
    this.refresh_koken=refresh_token
  },
})
